<?php
/*
*** For Propertymax Pro v0.3 and above ** To display a single random property.
Written by Steve Dawson - www.stevedawson.com
Amended 04-07-06 - display default image
*/
{
require ( "includes/config.php" );
require ( "includes/CGI.php" );
require ( "includes/SQL.php" );
  
  $cgi = new CGI ();
  $sql = new SQL ( $DBusername, $DBpassword, $server, $database );

  if ( ! $sql->isConnected () )
  {
    die ( $DatabaseError );
  }
   require ( "includes/CSQL.php" ); 

  
  $rows = $sql->execute ( "SELECT * FROM $property_table WHERE propertyshow = '1' and user = '0' ORDER BY RAND() LIMIT 1",
  SQL_RETURN_ASSOC );
  $row = $rows [ 0 ];
  
  
 {
 print "<p><a href=\"index.php?op=mi&id=$row[id]\">";
 if ($row [ 'propertyphoto1' ] ){ print "<IMG SRC=\"".$ImageURL."$row[propertyphoto1]\" BORDER=\"0\" WIDTH=\"$max_thumb_image_width\" HEIGHT=\"$max_thumb_image_height\">";}
 else { print "<IMG SRC=\"".$ImageURL."nopropertyimage.jpg\" BORDER=\"0\" WIDTH=\"$max_thumb_image_width\" HEIGHT=\"$max_thumb_image_height\">";}
 print "</a><br>$row[propertyaddress]</p>";

}


  $sql->execute ( "UPDATE " . $property_table . " set USER = '1' WHERE id = '" . $row[id] . "'");
  


}
    ?>